#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@__author:gaoxiaojun
'''
import unittest,time
import HTMLTestRunner
import sys
path ='./func'
sys.path.append(path)
print(sys.path)
from func.sendMail import  GetNewReportAndSendMail
case_dir ='./src'
def all_case():
    discover = unittest.defaultTestLoader.discover(case_dir,pattern='test*.py')
    return discover
if __name__=="__main__":
    now =time.strftime("%Y-%m-%d %H_%M_%S")
    report_file='./reports/' + now +'.html'
    print('report_file',report_file)
    with open(report_file,'wb') as f:
        runner= HTMLTestRunner.HTMLTestRunner(stream=f,title=u'测试报告',description=u'测试用例执行的情况',verbosity=2)
        runner.run(all_case())
    AA = GetNewReportAndSendMail()
    AA.sendMail()


